//
//  BiblioController.h
//  Bibliotecha
//
//  Created by Jaime Garnica on 4/16/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <PDFkit/PDFkit.h>
#import "LibraryController.h"
#import "GetInfo.h"
#import "SetPreferences.h"


@interface BiblioController : NSObject {
	
	IBOutlet NSTableView *typeView;
	IBOutlet NSTableView *categoryView;
	IBOutlet NSTableView *subjectView;
	IBOutlet NSTableView *bookView;
	IBOutlet PDFView *document;
	IBOutlet NSWindow *mainWindow;
	IBOutlet NSMenuItem *removeBook;
	IBOutlet NSSearchFieldCell *searchBox;
	
	IBOutlet NSDrawer *outlineDrawer;
	IBOutlet NSOutlineView *documentOutline;
	
	LibraryController *theLibrary;
	GetInfo *editInfo;
	SetPreferences *editPreferences;
	
}


#pragma mark Received Actions

- (IBAction)getInfo:(id)sender; //get info from menu

- (IBAction)openLibrary:(id)sender; //open an xml containing the description of a library

- (IBAction)newLibrary:(id)sender; //make a new library

- (IBAction)consolidateLibrary:(id)sender; //copy all files to application-maintained folders in the library location

- (IBAction)openPreferences:(id)sender; //show preferences window

- (IBAction)showInFinder:(id)sender; //show a selected file in the finder

- (IBAction)openDoc:(id)sender; //add a file to the library

- (IBAction)removeBook:(id)sender;

- (IBAction)synchronize:(id)sender;

- (IBAction)openSyncLibrary:(id)sender;

- (IBAction)search:(id)sender;

- (IBAction)openDrawer:(id)sender;


#pragma mark NSApplication Delegate Methods

- (void)applicationDidFinishLaunching:(NSNotification *)notification;

- (void)applicationWillTerminate:(NSNotification *)aNotification;


#pragma mark NSTableView Datasource Methods

- (int)numberOfRowsInTableView:(NSTableView *)aTableView;

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;


#pragma mark NSTableView Delegate Methods

- (void)tableViewSelectionDidChange:(NSNotification *)aNotification;


#pragma mark NSOutlineView Datasource Methods

- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;

- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; 

- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;


#pragma mark NSOutlineView Delegate Methods

- (void)outlineViewSelectionDidChange:(NSNotification *)notification;


#pragma mark Notification Center Methods

- (void)updateColumnsAfterInfo:(NSNotification *)notification;

- (void) pageChanged: (NSNotification *) notification;


#pragma mark Methods

- (void)fillColumns;


@end
